package com.boxin.ims.modules.bi.web;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.boxin.ims.modules.bi.dao.BIDao;
import com.boxin.ims.modules.bi.entity.Series;
import com.boxin.ims.modules.bi.entity.Tooltip;
import com.boxin.ims.modules.bi.utils.DateProcessingUtils;
import com.boxin.ims.modules.sys.scheduler.BiSceneProcessScheduler;
import com.boxin.ims.modules.wechat.entity.WechatMember;
import com.boxin.ims.modules.wechat.entity.WechatMenu;
import com.boxin.ims.modules.wechat.entity.WechatScene;
import com.boxin.ims.modules.wechat.entity.activity.ActivityConfig;
import com.boxin.ims.modules.wechat.service.WechatMenuService;
import com.boxin.ims.modules.wechat.service.WechatSceneService;
import com.boxin.ims.modules.wechat.service.activity.ActivityConfigService;
import com.boxin.ims.modules.wechat.utils.ActivityProcessorUtils;
import com.boxin.ims.modules.wechat.utils.AssertUtils;
import com.boxin.ims.modules.wechat.utils.WechatMenuUtils;
import com.boxin.ims.modules.wechat.utils.XMLUtils;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

/**
 * 用户信息统计
 * @author xiaoqian
 *
*	2014上午9:02:59
 */
@Controller
@RequestMapping(value = Global.ADMIN_PATH+"/bi/wechatMessage")
public class WechatMessageController extends BaseController {
	
	@Autowired
	private BIDao biDao;
	
	@Autowired
	private WechatSceneService wechatSceneService;
	
	
	@Autowired
	private ActivityConfigService activityConfigService;
	
	@Autowired
	private WechatMenuService wechatMenuService;
	
	
	@RequestMapping(value = {"list", ""})
	public String list( HttpServletRequest request, HttpServletResponse response, Model model) {
		Calendar cal = Calendar.getInstance();
		
		String time =request.getParameter("time");
		String scene =request.getParameter("scene");
		
		
		String year="";
		String month="";
		if(time==null||time==""){
			month=DateProcessingUtils.getmonth();
			year=cal.get(Calendar.YEAR)+"";
		}else{
			year=time.substring(0,time.indexOf("年"));
			month=time.substring(time.indexOf("年")+1, time.indexOf("月"));
			if(Integer.parseInt(month)<10){
				month=0+month;
			}
		}
		
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			Map<String, Object> params =new HashMap<String ,Object>();
			params.put("month",month);
			params.put("user_id",user.getId());
			params.put("bi_type",1);
			List<Map<String, Object>> list=biDao.queryBiDataResult(params);
			
			
			model.addAttribute("user",user);
			if(list.size()==1){
				model.addAttribute("series", list.get(0).get("result"));
			}else{
				model.addAttribute("title","数据有误" );
				model.addAttribute("user",user);
				model.addAttribute("data", 0);
				model.addAttribute("xAxis", 0);
			}
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "关注数分析");
		
		model.addAttribute("time",time);
		
		return "modules/bi/wechatMessageList";
	}
	
	@RequestMapping(value = "memberMessage")
	public String wechatMessage( HttpServletRequest request, HttpServletResponse response, Model model) {
		
		
		Map<String, Object> params=new HashMap<String, Object>();
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		params.put("user_id",user.getId());
		
		List<Map<String,Object>> MemberSexList=biDao.queryMemberSex(params);
		
		String man="";
		String wowan="";
		String Undefined="";
		String secrecy="";
		for (int i = 0; i < MemberSexList.size(); i++) {
			if(MemberSexList.get(i).get("sex")==null){
				Undefined=MemberSexList.get(i).get("COUNT(1)").toString();
			}
			if("女".equals(MemberSexList.get(i).get("sex"))){
				wowan=MemberSexList.get(i).get("COUNT(1)").toString();
			}
			if("男".equals(MemberSexList.get(i).get("sex"))){
				man=MemberSexList.get(i).get("COUNT(1)").toString();
			}
			if("保密".equals(MemberSexList.get(i).get("sex"))){
				secrecy=MemberSexList.get(i).get("COUNT(1)").toString();
			}
			
		}
		
		model.addAttribute("man", man);
		model.addAttribute("secrecy", secrecy);
		model.addAttribute("wowan", wowan);
		model.addAttribute("Undefined", Undefined);
		
		return "modules/bi/memberSexList";
	}
	
	
	
	@RequestMapping(value = "qrCodeSubscribeMessage")
	public String qrCodeSubscribeMessage( HttpServletRequest request, HttpServletResponse response, Model model) {
		
		String createTime=request.getParameter("createTime");
		
		
		String day="";
		if(StringUtils.isEmpty(createTime)){
			  SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd");
			  createTime=sdf.format(new Date());
		}
		day=createTime.replace("-", "");
		model.addAttribute("createTime", createTime);
		
		Map<String, Object> params=new HashMap<String, Object>();
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		
		if(AssertUtils.notEmpty(sellerIds)){
			
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		
		params.put("user_id",user.getId());
		params.put("day",day);
		
		
		List<Map<String,Object>> qrCodeSubscribeMessageList=biDao.queryQrCodeSubscribeMessage(params);
		
		if(qrCodeSubscribeMessageList.size()==0){
			model.addAttribute("message", "当天没有关注的人，请查询其他日期");
			return "modules/bi/qrCodeSubscribeMessageList";
		}
		
		
		WechatScene wechatScene = new WechatScene();
		user.setId(user.getId());
		wechatScene.setUser(user);
		List<WechatScene>  list=wechatSceneService.find(wechatScene);
		model.addAttribute("sceneList", list);
		
		List<Object[]> dataList=new ArrayList<Object[]>();
		
		for (int i = 0; i < list.size(); i++) {
			Object[] str=new Object[2];
			Integer falg=0;
			str[0]=list.get(i).getScene();
			for (int j = 0; j < qrCodeSubscribeMessageList.size(); j++) {
				String sceneId=DateProcessingUtils.getSceneId(qrCodeSubscribeMessageList.get(j).get("message").toString());
				System.out.println("sceneId:"+sceneId+"list.get(i).getSceneId()"+list.get(i).getSceneId());
				if(list.get(i).getSceneId()==Long.parseLong(sceneId)&&!sceneId.equals("-1")){
					falg++;
				}
			}
			System.out.println("----------------------------------------------");
			str[1]=falg;
			dataList.add(str);
		}
		
		System.out.println(dataList.toString());
		System.out.println(JSON.toJSON(dataList));
		
		model.addAttribute("data", JSON.toJSON(dataList));
		
		
		return "modules/bi/qrCodeSubscribeMessageList";
	}
	
	
	@RequestMapping(value = "qrCodeSubscribeMessageByDay")
	public String qrCodeSubscribeMessageByDay( HttpServletRequest request, HttpServletResponse response, Model model) {
		
		Calendar cal = Calendar.getInstance();
		
		String time =request.getParameter("time");
		String scene =request.getParameter("scene");
		
		
		
		String year="";
		String month="";
		if(time==null||time==""){
			month=DateProcessingUtils.getmonth();
			year=cal.get(Calendar.YEAR)+"";
		}else{
			year=time.substring(0,time.indexOf("年"));
			month=time.substring(time.indexOf("年")+1, time.indexOf("月"));
			if(Integer.parseInt(month)<10){
				month=0+month;
			}
		}
		
		
		
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			Map<String, Object> params =new HashMap<String ,Object>();
			params.put("month",month);
			params.put("user_id",user.getId());
			params.put("bi_type",3);
			List<Map<String, Object>> list=biDao.queryBiDataResult(params);
			
			
			if(list.size()==1){
				model.addAttribute("series", list.get(0).get("result"));
			}else{
				model.addAttribute("title","数据有误" );
				model.addAttribute("user",user);
				model.addAttribute("data", 0);
				model.addAttribute("xAxis", 0);
			}
			
			
			
			model.addAttribute("user",user);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "关注数分析");
		
		model.addAttribute("time",time);
		
		return "modules/bi/qrCodeSubscribeMessageByDayList";
	}
	
	
	
	@RequestMapping(value ="wechatReceiveList")
	public String wechatReceiveList( HttpServletRequest request, HttpServletResponse response, Model model) {
		Calendar cal = Calendar.getInstance();
		
		String time =request.getParameter("time");
		String scene =request.getParameter("scene");
		
		
		String year="";
		String month="";
		if(time==null||time==""){
			month=DateProcessingUtils.getmonth();
			year=cal.get(Calendar.YEAR)+"";
		}else{
			year=time.substring(0,time.indexOf("年"));
			month=time.substring(time.indexOf("年")+1, time.indexOf("月"));
			if(Integer.parseInt(month)<10){
				month=0+month;
			}
		}
		
		
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
				}
			}
		}
		
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			
			Map<String, Object> params =new HashMap<String ,Object>();
			params.put("month",month);
			params.put("user_id",user.getId());
			params.put("bi_type",4);
			List<Map<String, Object>> list=biDao.queryBiDataResult(params);
			
			
			if(list.size()==1){
				model.addAttribute("series", list.get(0).get("result"));
			}else{
				model.addAttribute("title","数据有误" );
				model.addAttribute("user",user);
				model.addAttribute("data", 0);
				model.addAttribute("xAxis", 0);
			}
			
			model.addAttribute("user",user);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "会员消息分析");
		
		model.addAttribute("time",  year+"年"+month+"月");
		
		return "modules/bi/wechatReceiveList";
	}
	
	
	@RequestMapping(value ="biWechatMemberList")
	public String biWechatMemberList( HttpServletRequest request, HttpServletResponse response, Model model) {
		Calendar cal = Calendar.getInstance();
		
		String time =request.getParameter("time");
		String scene =request.getParameter("scene");
		
		
		String year="";
		String month="";
		if(time==null||time==""){
			month=DateProcessingUtils.getmonth();
			year=cal.get(Calendar.YEAR)+"";
		}else{
			year=time.substring(0,time.indexOf("年"));
			month=time.substring(time.indexOf("年")+1, time.indexOf("月"));
			if(Integer.parseInt(month)<10){
				month=0+month;
			}
		}
		
		
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			Map<String, Object> params =new HashMap<String ,Object>();
			params.put("month",month);
			params.put("user_id",user.getId());
			params.put("bi_type",2);
			List<Map<String, Object>> list=biDao.queryBiDataResult(params);
			
			
			model.addAttribute("user",user);
			if(list.size()==1){
				model.addAttribute("series", list.get(0).get("result"));
			}else{
				model.addAttribute("title","数据有误" );
				model.addAttribute("user",user);
				model.addAttribute("data", 0);
				model.addAttribute("xAxis", 0);
			}
			
			model.addAttribute("user",user);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "会员注册分析");
		
		model.addAttribute("time",  time);
		
		return "modules/bi/biWechatMemberList";
	}
	
	
	
	@RequestMapping(value ="biAliveMemberList")
	public String biAliveMemberList( HttpServletRequest request, HttpServletResponse response, Model model) {
		Calendar cal = Calendar.getInstance();
		
		String time =request.getParameter("time");
		String scene =request.getParameter("scene");
		
		
		String year="";
		String month="";
		if(time==null||time==""){
			month=DateProcessingUtils.getmonth();
			year=cal.get(Calendar.YEAR)+"";
		}else{
			year=time.substring(0,time.indexOf("年"));
			month=time.substring(time.indexOf("年")+1, time.indexOf("月"));
			if(Integer.parseInt(month)<10){
				month=0+month;
			}
		}
		
		
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			Map<String, Object> params =new HashMap<String ,Object>();
			params.put("month",month);
			params.put("user_id",user.getId());
			params.put("bi_type",5);
			List<Map<String, Object>> list=biDao.queryBiDataResult(params);
			
			
			model.addAttribute("user",user);
			if(list.size()==1){
				model.addAttribute("series", list.get(0).get("result"));
			}else{
				model.addAttribute("title","数据有误" );
				model.addAttribute("user",user);
				model.addAttribute("data", 0);
				model.addAttribute("xAxis", 0);
			}
			
			model.addAttribute("user",user);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "平台活跃人数");
		
		model.addAttribute("time",  time);
		
		return "modules/bi/biAliveMemberList";
	}
	
	
	
	@RequestMapping(value ="wechatMenuList")
	public String wechatMenuList( HttpServletRequest request, HttpServletResponse response, Model model) throws NumberFormatException, ParseException {
		String time =request.getParameter("time");
		
		Calendar cal = Calendar.getInstance();
		 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		
		String year="";
		String month="";
		String today = null;
		String day="";
		if(time==null||time==""){
			today=format.format(new Date());
			month=DateProcessingUtils.getmonth();
			day=cal.get(Calendar.DAY_OF_MONTH)+"";
			year=cal.get(Calendar.YEAR)+"";
			time=today;
		}else{
			today = time;
			year=time.substring(0,4);
			month=time.substring(5,7);
			day=time.substring(8,10);
		}
		
		
		Map<String, Object> params=new HashMap<String, Object>();
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		
		params.put("user_id",user.getId());
		params.put("month", month);  
		params.put("year", year);  
		params.put("message_type", "event");  
		params.put("event_type", "CLICK");  
		params.put("time",today);
		
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			
			List<WechatMenu> wechatMenu= wechatMenuService.findMenusByUserId(user.getId(),"click");
			
			List<Map<String,Object>> wechatMenuMessageList=biDao.queryMenuMessage(params);
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			List<Series> seriesList =new ArrayList<Series>();
			
			for (int i = 0; i < wechatMenu.size(); i++) {
				List<Map<String,Object>> temp=new ArrayList<Map<String,Object>>();
				for (int j = 0; j < wechatMenuMessageList.size(); j++) {
					if(wechatMenuMessageList.get(j).get("message")!=null&&wechatMenu.get(i).getKeywords()!=null){
						if(wechatMenu.get(i).getKeywords().equals(wechatMenuMessageList.get(j).get("message")+"")){
							temp.add(wechatMenuMessageList.get(j));
						}
					}
				}
				Integer[] data=DateProcessingUtils.getDataByWeek( temp,format.parse(today));
				
				Series series1= new Series();
				series1.setName(wechatMenu.get(i).getName());
				series1.setType("column");
				Tooltip tooltip1 = new Tooltip();
				tooltip1.setValueSuffix("次");
				series1.setTooltip(tooltip1);
				series1.setData(data);
				series1.setPointStartByDay(year,(Integer.parseInt(month)-1)+"",Integer.parseInt(day)-3+"" );
				
				seriesList.add(series1);
				
			}
			
			
			StringBuffer stringBuffer = new StringBuffer();
			
			stringBuffer.append("[");
			for (int i = 0; i < seriesList.size(); i++) {
				
				stringBuffer.append(DateProcessingUtils.getSeriesJson(seriesList.get(i))).append(",");
			}
			stringBuffer.append("]");
			
			model.addAttribute("user",user);
			model.addAttribute("series", stringBuffer);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "会员菜单点击分析");
		
		model.addAttribute("time", time);
		System.out.println(time);
		
		return "modules/bi/wechatMenuMessageList";
	}
	
	
	@RequestMapping(value ="wechatMenuViewList")
	public String wechatMenuViewList( HttpServletRequest request, HttpServletResponse response, Model model) throws NumberFormatException, ParseException {
		String time =request.getParameter("time");
		
		Calendar cal = Calendar.getInstance();
		 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		
		String year="";
		String month="";
		String today = null;
		String day="";
		if(time==null||time==""){
			today=format.format(new Date());
			month=DateProcessingUtils.getmonth();
			day=cal.get(Calendar.DAY_OF_MONTH)+"";
			year=cal.get(Calendar.YEAR)+"";
			time=today;
		}else{
			today = time;
			year=time.substring(0,4);
			month=time.substring(5,7);
			day=time.substring(8,10);
		}
		
		
		Map<String, Object> params=new HashMap<String, Object>();
		User user=UserUtils.getUser();
		String sellerIds=request.getParameter("sellerIds");
		if(AssertUtils.notEmpty(sellerIds)){
			
			String[] userIds= sellerIds.split(",");
			if (user.isAdmin()){
				if(userIds.length==1){
					user=new User(Long.valueOf(userIds[0]));
					model.addAttribute("user", user);
				}
			}
		}
		
		
		params.put("user_id",user.getId());
		params.put("month", month);  
		params.put("year", year);  
		params.put("message_type", "event");  
		params.put("event_type", "VIEW");  
		params.put("time",today);
		
		
		if(month==null||year==null||Integer.parseInt(month)<0||Integer.parseInt(month)>13||year==""||month==""){
			model.addAttribute("title","数据有误" );
			model.addAttribute("user",user);
			model.addAttribute("data", 0);
			model.addAttribute("xAxis", 0);
		}else{
			
			
			List<WechatMenu> wechatMenu= wechatMenuService.findMenusByUserId(user.getId(),"view");
			
			List<Map<String,Object>> wechatMenuMessageList=biDao.queryMenuMessage(params);
			String[] ints =  DateProcessingUtils.daysMountBymonth(month,year);
			
			List<Series> seriesList =new ArrayList<Series>();
			
			for (int i = 0; i < wechatMenu.size(); i++) {
				List<Map<String,Object>> temp=new ArrayList<Map<String,Object>>();
				for (int j = 0; j < wechatMenuMessageList.size(); j++) {
					if(wechatMenuMessageList.get(j).get("message")!=null&&wechatMenu.get(i).getUrl()!=null){
						if(wechatMenu.get(i).getUrl().equals(wechatMenuMessageList.get(j).get("message")+"")){
							temp.add(wechatMenuMessageList.get(j));
						}
					}
				}
				Integer[] data=DateProcessingUtils.getDataByWeek( temp,format.parse(today));
				
				Series series1= new Series();
				series1.setName(wechatMenu.get(i).getName());
				series1.setType("column");
				Tooltip tooltip1 = new Tooltip();
				tooltip1.setValueSuffix("次");
				series1.setTooltip(tooltip1);
				series1.setData(data);
				series1.setPointStartByDay(year,(Integer.parseInt(month)-1)+"",Integer.parseInt(day)-3+"" );
				
				seriesList.add(series1);
				
			}
			
			
			StringBuffer stringBuffer = new StringBuffer();
			
			stringBuffer.append("[");
			for (int i = 0; i < seriesList.size(); i++) {
				
				stringBuffer.append(DateProcessingUtils.getSeriesJson(seriesList.get(i))).append(",");
			}
			stringBuffer.append("]");
			
			model.addAttribute("user",user);
			model.addAttribute("series", stringBuffer);
			model.addAttribute("xAxis", JSON.toJSONString(ints));
		}
		model.addAttribute("title", "会员菜单跳转链接分析");
		
		model.addAttribute("time", time);
		System.out.println(time);
		
		return "modules/bi/wechatMenuViewMessageList";
	}
	
	
	@RequestMapping(value ="test")
	public String test( HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
		
//		StringBuffer sb = new StringBuffer();
//		
//		sb.append("<xml><ToUserName><![CDATA[toUser]]></ToUserName>");
//		sb.append("<FromUserName><![CDATA[FromUser]]></FromUserName>");
//		sb.append("<CreateTime>123456789</CreateTime>");
//		sb.append("<MsgType><![CDATA[event]]></MsgType>");
//		sb.append("<Event><![CDATA[subscribe]]></Event>");
//		sb.append("<EventKey><![CDATA[qrscene_2]]></EventKey>");
//		sb.append("<Ticket><![CDATA[TICKET]]></Ticket>");
//		sb.append("</xml>");
//		
//		
//		
//		Map<String,String> map = XMLUtils.xml2Map(sb.toString());
//		User user=UserUtils.getUser();
//		biDao.addSceneCount(user, map);
		
		
		WechatMember member=new WechatMember();
		ActivityConfig activityConfig=activityConfigService.get(1L);
		ActivityProcessorUtils.startActivityProcessor(member, activityConfig, null);
		
		return null;
	}
}

